<?php
namespace Admin\Controller;

use Util\AccessController;

class BookListController extends AccessController {
    public function Index() {
        $where['ts_booklist_inventory.booklist_id'] = $_GET['banner_id'];
        $LS = Service('BookList', 'booklist_inventory');
        $DATA = $LS->query($where,null,null,"ts_book on ts_book.ID = ts_booklist_inventory.book_id");


        $this->DATA = $DATA;
        $this->banner_id = $_GET['banner_id'];
        $this->display('BookIndex');
    }

    public function AddBook() {
        $save['inventory_id'] = 'bli_' . uniqid() . rand();
        $save['booklist_id'] = $_POST['banner_id'];
        $save['book_id'] = $_POST['ID'];
        $LS = Service('BookList', 'booklist_inventory');
        $OK = $LS->insert($save);
        echo $OK;
    }

    public function ycsd(){
        $where['inventory_id'] = $_POST['ID'];
        $LS = Service('BookList', 'booklist_inventory');
        $OK = $LS->remove($where);
        echo $OK;
    }


}